package cn.fulong.smebj.mapper;

import cn.fulong.smebj.entity.Question;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface QuestionMapper extends BaseMapper<Question> {

    @Select("select * from question order by create_time desc")
    IPage<Map<String,Object>> selectAll(IPage ipage);

    @Select("select q.* from question q " +
            "left join answer a on q.id=a.question_id where status is not null order by q.create_time desc ")
    IPage<Map<String,Object>> selectAlreadyAnswer(IPage ipage);
}